package chat.client;

import java.util.ArrayList;
import java.util.concurrent.Semaphore;

import chat.State;
import chat.VectorClock;
import chat.client.statemachine.chat.ChatMessageContent;

/**
 * This class defines the attributes of the state of the client in the state
 * machine. All the attributes are public are special care must be taken to
 * access these attributes when multi-threading: The semaphore must be used in
 * this case.
 * 
 * @author Denis Conan
 * 
 */
public class ChatClientState extends State {
	public int identity;
	public int nbChatMessageContentReceived;
	public int nbChatMessageContentSent;
	public Semaphore semaphore = new Semaphore(1);
	
	/* Wait queue for messages (ChatMessageContent) */
	public ArrayList<ChatMessageContent> messageBag;
	
	/* Local lock of this client */
	public VectorClock localClock;
	
	public ChatClientState() {
		localClock = new VectorClock();
		messageBag = new ArrayList<ChatMessageContent>();
	}
	
}
